package com.example.demo.infra.repository.impl;

import com.example.demo.app.repository.TeacherRepository;
import com.example.demo.domain.entity.Teacher;
import com.example.demo.infra.mapper.TeacherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class TeacherRepositoryImpl implements TeacherRepository {
    @Autowired
    private TeacherMapper teacherMapper;

    @Override
    public Teacher queryTeacherById(Integer id) {
        return teacherMapper.selectTeacherById(id);
    }

    @Override
    public List<Teacher> queryTeacherList() {
        return teacherMapper.selectTeacherList();
    }

    @Override
    public Integer addTeacher(Teacher teacher) {
        return teacherMapper.insertTeacher(teacher);
    }

    @Override
    public Integer saveTeacher(Teacher teacher) {
        return teacherMapper.updateTeacher(teacher);
    }

    @Override
    public Integer deleteTeacherById(Integer id) {
        return teacherMapper.deleteTeacherById(id);
    }
}
